package xyz.xiangyushui.controller.membership.renewal;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import xyz.xiangyushui.dao.user.member.MembershipDao;
import xyz.xiangyushui.dao.user.member.MembershipProfileDao;

/**
 * Servlet implementation class RenewalPay
 */
@WebServlet("/member/renewal")
public class Renewal extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private MembershipProfileDao mpd;
	private MembershipDao md;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public Renewal() {
        super();
        mpd=new MembershipProfileDao();
        md=new MembershipDao();
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setAttribute("bankCard", mpd.getBankCard((String) request.getSession(false).getAttribute("userName")));
		request.setAttribute("balance", md.getBalance((String) request.getSession(false).getAttribute("userName")));
		request.getRequestDispatcher("/member/membershipRenewal/renewal.jsp").forward(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
